/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package JPA;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author Jrdevelopment
 */
public class JPAEntityManager {

    public static EntityManager getEntityManager() {
        try {
            String UNIDAD_DE_PERSISTENCIA = "spectator-sports-online";
            //EntityManagerFactory factory = Persistence.createEntityManagerFactory(UNIDAD_DE_PERSISTENCIA, System.getProperties());
            EntityManagerFactory factory = Persistence.createEntityManagerFactory(UNIDAD_DE_PERSISTENCIA);
            EntityManager em = factory.createEntityManager();

            return em;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}
